package cn.jathlon.datastructure;

import java.util.BitSet;

/**
 * Large scale Graph(unweighed, directed or undirected.) structure based on BitMap, 
 * allowing size 1000000 x 1000000 that maybe just limited by your machine.
 * @author tuxiao.czz
 *
 */
public class BitMapUnweighedGraph {

	private BitSet [] bitSetArr;
	
	//////////------------construction method
	public BitMapUnweighedGraph(int row, int column){
		bitSetArr = new BitSet[row];
		for (int i = 0; i < row; i++) {
			bitSetArr[i] = new BitSet();
		}
	}
	
	public void connect(int row, int column){
		bitSetArr[row].set(column, true);
	}
	
	public void disConnect(int row, int column){
		bitSetArr[row].set(column, false);
	}

	public BitSet[] getBitSetArr() {
		return bitSetArr;
	}

	public void setBitSetArr(BitSet[] bitSetArr) {
		this.bitSetArr = bitSetArr;
	}
	
	////////test
	public static void main(String[] args) {
		BitMapUnweighedGraph g = new BitMapUnweighedGraph(1000000, 1000000);
		g.connect(100000, 30000);
	}
	
}
